<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>

<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta content="text/html;charset=utf-8">
<title>项目列表</title></head>
<link href="resources/bootstrap/css/bootstrap.min.css" rel="stylesheet">
<link href="resources/bootstrap/css/bootstrap-theme.min.css" rel="stylesheet">
<link href="resources/css/index.css" rel="stylesheet">

<body onload="queryErro();">
	<s:include value="../header-common.jsp" />
<div class="container">
	
	<div class="row">
		<div class="">
			<s:form id="formQuery" name="form" action="queryProject" method="post">
				<div class="col-md-8" style="float:none;margin:auto;">
					<div class="input-group input-group-lg">
						<input type="text" class="form-control" name="queryKey" placeholder="请输入项目关键字查询">
						<span class="input-group-btn"><button class="btn btn-primary">
							<span class="glyphicon glyphicon-search"></span></button></span>
					</div>
				</div>
			</s:form>
		</div>
		<s:set var="set" value="#{1:'关闭',2:'开启'}"></s:set>
		<s:if test="queryErro.length() > 0">
			<div id="queryErroAlert" class="alert alert-danger col-sm-12">
				${queryErro }
			</div>
		</s:if>
		<s:form id="formProject" name="form" action="projectDetail" method="post" >
		<table class="table table-striped table-bordered table-hover table-condensed table-responsive">
		<tr class="success">
			<td class="textCenter">序号</td>
			<td class="textCenter">项目名称</td>
			<td class="textCenter">项目状态</td>
			<td class="textCenter">创建时间</td>
			<td class="textCenter">操作</td>
		</tr>
		<s:iterator value="listProject" var="list" begin="begin" end="end" status="status">
		<tr class="warning">
			<td><s:property value="%{#status.index+begin+1}"/></td>
			<td><s:property value="#list.projectName"/></td>
			<td><s:property value="#set[#list.projectStatus]" /></td>
			<td><s:date name="#list.createTime" format="yyyy-MM-dd HH:mm:ss"/></td>
			<td class="textCenter">
				<button class="btn btn-info" data-toggle="tab" 
					onclick="projectDetail(${list.projectId});">详情</button>
			</td>
		</tr>
		</s:iterator>
		</table>
		<input id="projectId" name="projectId" style="display:none;" />
		</s:form>
	</div>
	<div class="">
		<s:form id="formPage" name="form" action="toProjectPage" method="post">
			<ul class="pagination" style="display:inline;">
				<s:if test="begin <= 1">
					<li class="disabled"><a>上一页</a></li>
				</s:if>
				<s:else>
					<li><a href="preProjectPage.do" title="上一页">上一页</a></li>
				</s:else>
				<s:bean name="org.apache.struts2.util.Counter">
					<s:param name="first" value= "1" />
				    <s:param name="last" value= "(listProject.size()-1)/10+1" />
				    <s:iterator status="status">
				    	<s:if test="#status.index==page-1">
				     	 	<li class="active"><a href="#" data-toggle="tab"
				     	 		onclick="toPage(this);"><s:property /></a></li>
				    	</s:if>
				    	<s:else>
				    		<li><a href="#" data-toggle="tab"
				    			onclick="toPage(this);"><s:property /></a></li>
				    	</s:else>
				    </s:iterator>
				</s:bean>
				<s:if test="end >= listProject.size()-1">
					<li class="disabled"><a>下一页</a></li>
				</s:if>
				<s:else>
					<li><a href="nextProjectPage.do" title="下一页">下一页</a></li>
				</s:else>
				<li>
					<input id="pageId" name="page" class="form-control" 
						style="float:left;width:50px;" value="${page }" />
					<input class="btn btn-primary" style="float:left;" type="submit" value="GO" />
				</li>
			</ul>
			
	    </s:form>
	</div>
</div>
	<script src="resources/bootstrap/js/jquery.min.js"></script>
	<script src="resources/bootstrap/js/bootstrap.min.js"></script>
	<script src="resources/js/common.js"></script>
</body>
</html>
